home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / troangel.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  9KB  |  249 lines

  1. /****************************************************************************
  2.  
  3. Tropical Angel
  4.  
  5. driver by Phil Stroffolino
  6.  
  7. ****************************************************************************/
  8. #include "driver.h"
  9. #include "sndhrdw/irem.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12. extern unsigned char *troangel_scroll;
  13. WRITE_HANDLER( troangel_flipscreen_w );
  14. void troangel_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  15. void troangel_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  16.  
  17.  
  18.  
  19. static struct MemoryReadAddress troangel_readmem[] =
  20. {
  21.     { 0x0000, 0x7fff, MRA_ROM },
  22.     { 0x8000, 0x8fff, MRA_RAM },
  23.     { 0x9000, 0x90ff, MRA_RAM },
  24.     { 0xd000, 0xd000, input_port_0_r },
  25.     { 0xd001, 0xd001, input_port_1_r },
  26.     { 0xd002, 0xd002, input_port_2_r },
  27.     { 0xd003, 0xd003, input_port_3_r },
  28.     { 0xd004, 0xd004, input_port_4_r },
  29.     { 0xe000, 0xe7ff, MRA_RAM },
  30.     { -1 }    /* end of table */
  31. };
  32.  
  33. static struct MemoryWriteAddress troangel_writemem[] =
  34. {
  35.     { 0x0000, 0x7fff, MWA_ROM },
  36.     { 0x8000, 0x87ff, videoram_w, &videoram, &videoram_size },
  37. //    { 0x8800, 0x8fff, MWA_RAM },
  38.     { 0x9000, 0x91ff, MWA_RAM, &troangel_scroll },
  39.     { 0xc820, 0xc8ff, MWA_RAM, &spriteram, &spriteram_size },
  40.     { 0xd000, 0xd000, irem_sound_cmd_w },
  41.     { 0xd001, 0xd001, troangel_flipscreen_w },    /* + coin counters */
  42.     { 0xe000, 0xe7ff, MWA_RAM },
  43.     { -1 }    /* end of table */
  44. };
  45.  
  46.  
  47.  
  48. INPUT_PORTS_START( troangel )
  49.     PORT_START    /* IN0 */
  50.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  51.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  52.     /* coin input must be active for 19 frames to be consistently recognized */
  53.     PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_LOW, IPT_COIN3, 19 )
  54.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
  55.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  56.  
  57.     PORT_START    /* IN1 */
  58.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  59.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  60.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  61.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  62.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  63.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  64.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  65.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  66.  
  67.     PORT_START    /* IN2 */
  68.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  69.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
  70.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  71.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  72.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
  73.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  74.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  75.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  76.  
  77.     PORT_START    /* DSW1 */
  78.     PORT_DIPNAME( 0x03, 0x03, "Time" )
  79.     PORT_DIPSETTING(    0x03, "180 160 140" )
  80.     PORT_DIPSETTING(    0x02, "160 140 120" )
  81.     PORT_DIPSETTING(    0x01, "140 120 100" )
  82.     PORT_DIPSETTING(    0x00, "120 100 100" )
  83.     PORT_DIPNAME( 0x04, 0x04, "Crash Loss Time" )
  84.     PORT_DIPSETTING(    0x04, "5" )
  85.     PORT_DIPSETTING(    0x00, "10" )
  86.     PORT_DIPNAME( 0x08, 0x08, "Background Sound" )
  87.     PORT_DIPSETTING(    0x08, "Boat Motor" )
  88.     PORT_DIPSETTING(    0x00, "Music" )
  89.     /* TODO: support the different settings which happen in Coin Mode 2 */
  90.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) ) /* mapped on coin mode 1 */
  91.     PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
  92.     PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
  93.     PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
  94.     PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
  95.     PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
  96.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  97.     PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )
  98.     PORT_DIPSETTING(    0x60, DEF_STR( 1C_3C ) )
  99.     PORT_DIPSETTING(    0x50, DEF_STR( 1C_4C ) )
  100.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
  101.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_6C ) )
  102.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  103.     /* settings 0x10, 0x20, 0x80, 0x90 all give 1 Coin/1 Credit */
  104.  
  105.     PORT_START    /* DSW2 */
  106.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  107.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  108.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  109.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
  110.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  111.     PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
  112. /* This activates a different coin mode. Look at the dip switch setting schematic */
  113.     PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
  114.     PORT_DIPSETTING(    0x04, "Mode 1" )
  115.     PORT_DIPSETTING(    0x00, "Mode 2" )
  116. /* TODO: the following enables an analog accelerator input read from 0xd003 */
  117. /* however that is the DSW1 input so it must be multiplexed some way */
  118.     PORT_DIPNAME( 0x08, 0x08, "Analog Accelarator" )
  119.     PORT_DIPSETTING(    0x08, DEF_STR( No ) )
  120.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  121.     /* In stop mode, press 2 to stop and 1 to restart */
  122.     PORT_BITX   ( 0x10, 0x10, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Stop Mode", IP_KEY_NONE, IP_JOY_NONE )
  123.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  124.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  125.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  126.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  127.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  128.     PORT_BITX(    0x40, 0x40, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
  129.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  130.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  131.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  132. INPUT_PORTS_END
  133.  
  134.  
  135.  
  136. static struct GfxLayout charlayout =
  137. {
  138.     8,8, /* character size */
  139.     1024, /* number of characters */
  140.     3, /* bits per pixel */
  141.     { 0, 1024*8*8, 2*1024*8*8 },
  142.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  143.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  144.     8*8    /* character offset */
  145. };
  146.  
  147. static struct GfxLayout spritelayout =
  148. {
  149.     16,32, /* sprite size */
  150.     64, /* number of sprites */
  151.     3, /* bits per pixel */
  152.     { 0, 0x4000*8, 2*0x4000*8 },
  153.     { 0, 1, 2, 3, 4, 5, 6, 7,
  154.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
  155.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  156.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8,
  157.             256*64+0*8, 256*64+1*8, 256*64+2*8, 256*64+3*8, 256*64+4*8, 256*64+5*8, 256*64+6*8, 256*64+7*8,
  158.             256*64+8*8, 256*64+9*8, 256*64+10*8, 256*64+11*8, 256*64+12*8, 256*64+13*8, 256*64+14*8, 256*64+15*8 },
  159.     32*8    /* character offset */
  160. };
  161.  
  162. static struct GfxDecodeInfo troangel_gfxdecodeinfo[] =
  163. {
  164.     { REGION_GFX1, 0x0000, &charlayout,      0, 32 },
  165.     { REGION_GFX2, 0x0000, &spritelayout, 32*8, 32 },
  166.     { REGION_GFX2, 0x1000, &spritelayout, 32*8, 32 },
  167.     { REGION_GFX2, 0x2000, &spritelayout, 32*8, 32 },
  168.     { REGION_GFX2, 0x3000, &spritelayout, 32*8, 32 },
  169.     { -1 } /* end of array */
  170. };
  171.  
  172.  
  173.  
  174. static struct MachineDriver machine_driver_troangel =
  175. {
  176.     /* basic machine hardware */
  177.     {
  178.         {
  179.             CPU_Z80,
  180.             3000000,    /* 3 Mhz ??? */
  181.             troangel_readmem,troangel_writemem,
  182.             0,0,
  183.             interrupt,1
  184.         },
  185.         IREM_AUDIO_CPU
  186.     },
  187.     57, 1790,    /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. */
  188.                 /* the Lode Runner manual (similar but different hardware) */
  189.                 /* talks about 55Hz and 1790ms vblank duration. */
  190.     1, /* cpu slices */
  191.     0, /* init machine */
  192.  
  193.     /* video hardware */
  194.     32*8, 32*8, { 1*8, 31*8-1, 1*8, 31*8-1 },
  195.     troangel_gfxdecodeinfo,
  196.     32*8+16,32*8+32*8,
  197.     troangel_vh_convert_color_prom,
  198.  
  199.     VIDEO_TYPE_RASTER,
  200.     0,
  201.     generic_vh_start,
  202.     generic_vh_stop,
  203.     troangel_vh_screenrefresh,
  204.  
  205.  
  206.     /* sound hardware */
  207.     0,0,0,0,
  208.     {
  209.         IREM_AUDIO
  210.     }
  211. };
  212.  
  213.  
  214.  
  215.  
  216. ROM_START( troangel )
  217.     ROM_REGION( 0x10000, REGION_CPU1 )    /* main CPU */
  218.     ROM_LOAD( "ta-a-3k",    0x0000, 0x2000, 0xf21f8196 )
  219.     ROM_LOAD( "ta-a-3m",    0x2000, 0x2000, 0x58801e55 )
  220.     ROM_LOAD( "ta-a-3n",    0x4000, 0x2000, 0xde3dea44 )
  221.     ROM_LOAD( "ta-a-3q",    0x6000, 0x2000, 0xfff0fc2a )
  222.  
  223.     ROM_REGION(  0x10000 , REGION_CPU2 )    /* sound CPU */
  224.     ROM_LOAD( "ta-s-1a",    0xe000, 0x2000, 0x15a83210 )
  225.  
  226.     ROM_REGION( 0x06000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  227.     ROM_LOAD( "ta-a-3c",    0x00000, 0x2000, 0x7ff5482f )    /* characters */
  228.     ROM_LOAD( "ta-a-3d",    0x02000, 0x2000, 0x06eef241 )
  229.     ROM_LOAD( "ta-a-3e",    0x04000, 0x2000, 0xe49f7ad8 )
  230.  
  231.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  232.     ROM_LOAD( "ta-b-5j",    0x00000, 0x2000, 0x86895c0c )    /* sprites */
  233.     ROM_LOAD( "ta-b-5h",    0x02000, 0x2000, 0xf8cff29d )
  234.     ROM_LOAD( "ta-b-5e",    0x04000, 0x2000, 0x8b21ee9a )
  235.     ROM_LOAD( "ta-b-5d",    0x06000, 0x2000, 0xcd473d47 )
  236.     ROM_LOAD( "ta-b-5c",    0x08000, 0x2000, 0xc19134c9 )
  237.     ROM_LOAD( "ta-b-5a",    0x0a000, 0x2000, 0x0012792a )
  238.  
  239.     ROM_REGION( 0x0320, REGION_PROMS )
  240.     ROM_LOAD( "ta-a-5a",    0x0000,    0x0100, 0x01de1167 ) /* chars palette low 4 bits */
  241.     ROM_LOAD( "ta-a-5b",    0x0100,    0x0100, 0xefd11d4b ) /* chars palette high 4 bits */
  242.     ROM_LOAD( "ta-b-1b",    0x0200, 0x0020, 0xf94911ea ) /* sprites palette */
  243.     ROM_LOAD( "ta-b-3d",    0x0220,    0x0100, 0xed3e2aa4 ) /* sprites lookup table */
  244. ROM_END
  245.  
  246.  
  247.  
  248. GAME( 1983, troangel, 0, troangel, troangel, 0, ROT0, "Irem", "Tropical Angel" )
  249.